package cn.com.customer.manager.ui.message.email

import cn.com.customer.manager.bean.EmailListInfo
import cn.com.customer.manager.bean.MessageListInfo
import cn.com.customer.manager.bean.RequestBean
import cn.com.customer.manager.http.BaseApi
import cn.com.customer.manager.http.subscriber.TipRequestSubscriber
import com.xuexiang.xhttp2.XHttp
import com.xuexiang.xhttp2.XHttpProxy
import com.xuexiang.xhttp2.annotation.ThreadType
import com.xuexiang.xhttp2.model.ApiResult

class EmailPresenter constructor(view:EmailConstract.View) :EmailConstract.Presenter {
  var  mView:EmailConstract.View=view
    override fun getEmailList(parames: MutableMap<String, String>) {
        val request = XHttp.custom()
        request.call(request.create(BaseApi.IMessage::class.java)
                .mailInboxList(RequestBean(parames)))
                .subscribeWith(object : TipRequestSubscriber<ApiResult<EmailListInfo>?>() {
                    override fun onSuccess(apiResult: ApiResult<EmailListInfo>?) {
                        apiResult?.let {
                            mView.setEmailList(it.data)
                        }
                    }
                })
    }



    override fun start() {

    }
}